<template>
    <el-table :data="tableData" border highlight-current-row @selection-change="handleSelectionChange">
        <el-table-column type="selection" align="center"></el-table-column>
        <el-table-column type="index" label="序号" width="70" align="center"></el-table-column>
        <el-table-column property="name" label="名称" show-overflow-tooltip align="center"></el-table-column>
        <el-table-column property="mnemonicCode" show-overflow-tooltip label="助记码" align="center"></el-table-column>
        <el-table-column property="address" show-overflow-tooltip label="地址" align="center"></el-table-column>
        <el-table-column property="locationName" label="区域" show-overflow-tooltip align="center"></el-table-column>
        <el-table-column property="tradeName" label="行业" show-overflow-tooltip align="center"></el-table-column>
        <el-table-column property="state" label="状态" align="center">
            <template slot-scope="scope">
                <span style="color: green;" v-if="scope.row.state == 1">已启用</span>
                <span style="color: red;" v-else>已禁用</span>
            </template>
        </el-table-column>
        <el-table-column label="操作" align="center">
            <template slot-scope="scope">
                <span class="primary-text" @click="view(scope.row.id)">查看</span>
                <span class="primary-text" @click="updateRow(scope.row.id)">修改</span>
            </template>
        </el-table-column>
    </el-table>
</template>
<script>
export default {
    data() {
        return {
            tableData: this.$store.state.customerStore.tableData
        }
    },
    methods: {
        handleSelectionChange(arr) {
            this.$store.commit('customerStore/multipleSelection', arr);
        },
        updateRow(id) {           //修改
            this.$store.commit('customerStore/updateRowId', id);
            this.$util.openLayerIframe({title: '客户资料-修改', zIndex: 13, width: '550px', height: '80%', url: this.$domain + '/#/basicData/customer/form'});
        },
        view(id) {
            this.$store.commit('customerStore/updateRowId', id);
            this.$util.openLayerIframe({title: '客户资料-查看', zIndex: 13, width: '550px', height: '80%', url: this.$domain + '/#/basicData/customer/view'});
        }
    }
}
</script>